// shopPages/videoCourse/videoCourse.js
const app = getApp()
Page({

  /**
  * 页面的初始数据
  */
  data: {
    controls: true,
    Video1:[],
    Propaganda: [],
    video_id: ''
  },
  /**
  * 生命周期函数--监听页面加载
  */
  onLoad: function (options) {
    var that = this;
    wx.showLoading({
      title: '玩命加载中',
    })
    let url = '/video/videoList';
    let params = {
    }
    app.HttpGetSend(url, params, function (res) {
      if (res.msg != "success") {
        app.showTipMsg(res.msg);
      } else {
        wx.hideLoading();
        if (res.msg !== "success") {
          app.showTipMsg(res.msg);
        } else {
          var re_data = res.data;
          that.setData({
            Video1: re_data[0],
            Propaganda: re_data[1],
          });

        }
      }
    });
  },
  bindended: function (e) {
    var video1 = this.data.Video1
    for(var i = 0; i < video1.length; i++){
      video1[i].show = true;
    }
    this.setData({
      Video1: video1
    })
  },
  startPlayVideo: function (e) {
    var show = e.currentTarget.dataset.show
    var img_show = e.currentTarget.dataset.img_show
    var id = e.currentTarget.dataset.test
    var video1 = this.data.Video1
    for (var i = 0; i < video1.length; i++) {
      video1[i].show = true;
    }
    video1[id].show = false;

    var propaganda = this.data.Propaganda
    for (var i = 0; i < propaganda.length; i++) {
      propaganda[i].show = true;
    }
    this.setData({
      Video1: video1,
      Propaganda: propaganda
    })
  },
  bindended1: function (e) {
    var propaganda = this.data.Propaganda
    for (var i = 0; i < video1.length; i++) {
      propaganda[i].show = true;
    }
    this.setData({
      Propaganda: propaganda
    })
  },
  startPlayVideo1: function (e) {
    var show = e.currentTarget.dataset.show
    var img_show = e.currentTarget.dataset.img_show
    var id = e.currentTarget.dataset.test
    var propaganda = this.data.Propaganda
    for (var i = 0; i < propaganda.length; i++) {
      propaganda[i].show = true;
    }
    propaganda[id].show = false;

    var video1 = this.data.Video1
    for (var i = 0; i < video1.length; i++) {
      video1[i].show = true;
    }
    this.setData({
      Video1: video1,
      Propaganda: propaganda
    })
  },

  /**
  * 生命周期函数--监听页面初次渲染完成
  */
  onReady: function () {

  },

  /**
  * 生命周期函数--监听页面显示
  */
  onShow: function () {

  },

  /**
  * 生命周期函数--监听页面隐藏
  */
  onHide: function () {

  },
})